<%
# Copyright (C) 2011 - present Instructure, Inc.
#
# This file is part of Canvas.
#
# Canvas is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation, version 3 of the License.
#
# Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
#
# You should have received a copy of the GNU Affero General Public License along
# with this program. If not, see <http://www.gnu.org/licenses/>.
%>

<%= fields_for :settings, OpenObject.new(settings) do |f| %>
  <table style="width: 500px;" class="formtable">
    <tr>
      <td colspan="2"><%= mt(:description, <<-TEXT, :kaltura_url => 'http://www.kaltura.com', :notification_url => 'http://your_canvas_domain/media_objects/kaltura_notifications')
You will need an account either at [Kaltura.com](%{kaltura_url})
or with a self-hosted instance of Kaltura.

**Note:** once you have Kaltura configured within Canvas,
you need to go to the Kaltura Management Console and under "Settings ->
Integration Settings" enable server notifications with a
Notification URL of:

%{notification_url}

Then check the boxes for "Add Entry" and "Delete Entry" in the "Sent by Server" column.
TEXT
      %></td>
    </tr>
    <tr>
      <td colspan="2" class="sub">
        <h3>{{#t}}Domain Settings{{/t}}</h3>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :domain, :en => "Domain" %></td>
      <td>
        <%= f.text_field :domain %>
        <div class="hint">{{#t}}For hosted accounts, use "www.kaltura.com"{{/t}}</div>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :resource_domain, :en => "Resource Domain" %></td>
      <td>
        <%= f.text_field :resource_domain %>
        <div class="hint">{{#t}}For hosted accounts, use "cdn.kaltura.com"{{/t}}</div>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :rtmp_domain, :en => "RTMP Domain" %></td>
      <td>
        <%= f.text_field :rtmp_domain %>
        <div class="hint">{{#t}}For hosted accounts, use "www.kaltura.com"{{/t}}</div>
      </td>
    </tr>
    <tr>
      <td colspan="2" class="sub">
        <h3>{{#t}}Account Settings{{/t}}</h3>
        <p>{{#t}}These values can be found in the Kaltura Management Console under "Settings -> Integration Settings"{{/t}}</p>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :partner_id, :en => "Partner ID" %></td>
      <td><%= f.text_field :partner_id %></td>
    </tr>
    <tr>
      <td><%= f.blabel :subpartner_id, :en => "Sub Partner ID" %></td>
      <td><%= f.text_field :subpartner_id %></td>
    </tr>
    <tr>
      <td><%= f.blabel :secret_key, :en => "Administrator Secret" %></td>
      <td><%= f.text_field :secret_key %></td>
    </tr>
    <tr>
      <td><%= f.blabel :user_secret_key, :en => "User Secret" %></td>
      <td><%= f.text_field :user_secret_key %></td>
    </tr>
    <tr>
      <td colspan="2" class="sub">
        <h3>{{#t}}UI Conf IDs{{/t}}</h3>
        <p>{{#t}}For Kaltura-hosted customers, you can ask Kaltura to provide you with these ids.  Self-hosted instances can find these values in the ui_confs table.{{/t}}</p>
      </td>
    </tr>
    <tr>
      <td><%= f.blabel :player_ui_conf, :en => "Player UI Conf ID" %></td>
      <td><%= f.text_field :player_ui_conf %></td>
    </tr>
    <tr>
      <td><%= f.blabel :kcw_ui_conf, :en => "KCW UI Conf ID" %></td>
      <td><%= f.text_field :kcw_ui_conf %></td>
    </tr>
    <tr>
      <td><%= f.blabel :upload_ui_conf, :en => "Uploader UI Conf ID" %></td>
      <td><%= f.text_field :upload_ui_conf %></td>
    </tr>
    <tr>
      <td colspan="2" class="sub">
        <h3>{{#t}}Canvas Settings{{/t}}</h3>
      </td>
    </tr>
    <tr>
      <td>
        <%= f.blabel :cache_play_list_seconds, :en => "Seconds to cache playlist URL" %>
        <p style="font-size: 0.8em;">{{#t}}Empty means cache indefinitely, 0 means don't cache.{{/t}}</p>
      </td>
      <td><%= f.text_field :cache_play_list_seconds %></td>
    </tr>
    <tr>
      <td colspan="2" class="sub">
        <h3>{{#t}}Misc. Settings{{/t}}</h3>
      </td>
    </tr>
    <tr>
      <td>
        <%= f.blabel :kaltura_sis, :en => "Write SIS data to Kaltura" %>
        <p style="font-size: 0.8em;">{{#t}}If checked user and course SIS data will be provided to Kaltura.{{/t}}</p>
      </td>
      <td><%= f.check_box :kaltura_sis %></td>
    </tr>
    <tr>
      <td><%= f.label :do_analytics, :en => "Send analytics events" %></td>
      <td><%= f.check_box :do_analytics, {}, 'yes', 'no' %></td>
    </tr>
    <tr>
      <td colspan="2" style="font-size: 0.8em;">{{#t}}e.g.{{/t}}<code>(#{domain}/api_v3/index.php?service=stats&action=collect&...)</code></td>
    </tr>
    <tr>
      <td><%= f.label :hide_rte_button, :en => "Hide the video icon in Rich Content Editor." %></td>
      <td><%= f.check_box :hide_rte_button, {}, 'yes', 'no' %></td>
    </tr>
    <tr>
      <td colspan="2" style="font-size: 0.8em;">{{#t}}(still there for conversations/SpeedGrader/Media Recordings homework submissions){{/t}}</td>
    </tr>
    <tr>
      <td><%= f.label :js_uploader, :en => "Use html5 (accessible) uploader" %></td>
      <td><%= f.check_box :js_uploader, {}, 'yes', 'no' %></td>
    </tr>
  </table>
<% end %>
